/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nus.application.web.conference.form;

import com.nus.application.web.base.form.BaseForm;
import com.nus.dataaccess.dao.conference.Conference;
import com.nus.dataaccess.dao.conference.ConferenceAuthor;
import com.nus.dataaccess.scalar.FileUploadScalar;
import com.opensymphony.xwork2.util.XWorkList;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author robin.foe
 */
public class ConferenceSubmitForm extends BaseForm{
    
    private List<Conference> conferences;
    public List<Conference> getConferences() {return conferences;}
    public void setConferences(List<Conference> conferences) {this.conferences = conferences;}

    private ConferenceAuthor conferenceAuthor;
    public ConferenceAuthor getConferenceAuthor() {return conferenceAuthor;}
    public void setConferenceAuthor(ConferenceAuthor conferenceAuthor) {this.conferenceAuthor = conferenceAuthor;}
    
    private List<FileUploadScalar> fileUploads;
    public List<FileUploadScalar> getFileUploads() {return fileUploads;}
    public void setFileUploads(List<FileUploadScalar> fileUploads) {this.fileUploads = fileUploads;}
    public void addFileUpload(FileUploadScalar fileUploadScalar){
        this.fileUploads.add(fileUploadScalar);
    }
    
    
    private List<File> fileUpload;
    private List<String> fileUploadContentType = new ArrayList<String>();
    private List<String> fileUploadFileName = new ArrayList<String>();

    public List<File> getFileUpload() {
        return fileUpload;
    }

    public void setFileUpload(List<File> fileUpload) {
        this.fileUpload = fileUpload;
    }

    public List<String> getFileUploadContentType() {
        return fileUploadContentType;
    }

    public void setFileUploadContentType(List<String> fileUploadContentType) {
        this.fileUploadContentType = fileUploadContentType;
    }

    public List<String> getFileUploadFileName() {
        return fileUploadFileName;
    }

    public void setFileUploadFileName(List<String> fileUploadFileName) {
        this.fileUploadFileName = fileUploadFileName;
    }
    
    
    
    private boolean allowEdit = false;
    public boolean isAllowEdit() {return allowEdit;}
    public void setAllowEdit(boolean allowEdit) {this.allowEdit = allowEdit;}
    
    
    public ConferenceSubmitForm(){
        this.conferences = new ArrayList<Conference>();
        this.conferenceAuthor = new ConferenceAuthor();
        
        // running out of time, hack through the class to get it work
        this.fileUploads =  new ArrayList<FileUploadScalar>(){
            @Override
            public FileUploadScalar get(int idx){
                if(super.size() <= idx ){
                    super.add(new FileUploadScalar());
                }
                return super.get(idx);
            }
        };
                //new ArrayList<FileUploadScalar>();
    }

    @Override
    public List<Conference> getList() {return this.getConferences();}
    
}
